<?php

App::uses('Shell', 'Console');
App::uses('TestEnvironment', 'Lib');
App::uses('FileSystem', 'Base.Lib');
App::uses('PsfmAdmin', 'Lib');

class StaticTagsShell extends AppShell {

    /**
     * get the option parser.
     *
     * @return void
     */
    public function getOptionParser() {
        $parser = parent::getOptionParser();
        $parser->description('Cria uma cópia do ambiente de arquivos.');
        $parser->addOptions(array(
            'skip-all' => array(
                'default' => false,
                'boolean' => true,
                'help' => __('Do not update all documents tag')
            )
            ,
            'skip-all-non-tagged' => array(
                'default' => false,
                'boolean' => true,
                'help' => __('Do not update all non tagged documents tag')
            )
        ));

        return $parser;
    }

    public function main() {
        if (!$this->params['skip-all']) {
            PsfmAdmin::updateAllDocumentsTag();
        }
        if (!$this->params['skip-all-non-tagged']) {
            PsfmAdmin::updateAllDocumentsNonTaggedTag();
        }
    }

}